<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="father">
    <h1>标题1</h1>
    <p id="p1"></p>
    <p class="p2"></p>
</div>
<script>
    let self = document.getElementById('p1');
    let father = self.parentElement;
    father.removeChild(self);
    // self.remove(); //删除自身，这个方法兼容性不好，谨慎使用
</script>
</body>
</html>